#include <gtest/gtest.h>
#include <string>
#include "cx_string/cx_string_to_array.h" 

using namespace CXLib;

TEST(CXStringTest, SplitCharBasic) {
    const char* input = "a,b,c";
    CXString<char> cx(input);
    auto result = cx.split(",");

    ASSERT_EQ(result.size(), 3);
    EXPECT_EQ(result[0], "a");
    EXPECT_EQ(result[1], "b");
    EXPECT_EQ(result[2], "c");
}

TEST(CXStringTest, SplitCharWithEmptyElement) {
    const char* input = "a,,c";
    CXString<char> cx(input);
    auto result = cx.split(",");

    ASSERT_EQ(result.size(), 3);
    EXPECT_EQ(result[0], "a");
    EXPECT_EQ(result[1], "");
    EXPECT_EQ(result[2], "c");
}

TEST(CXStringTest, SplitCharNoDelimiter) {
    const char* input = "abc";
    CXString<char> cx(input);
    auto result = cx.split(",");

    ASSERT_EQ(result.size(), 1);
    EXPECT_EQ(result[0], "abc");
}

TEST(CXStringTest, SplitWCharBasic) {
    const wchar_t* input = L"a,b,c";
    CXString<wchar_t> cx(input);
    auto result = cx.split(L",");

    ASSERT_EQ(result.size(), 3);
    EXPECT_EQ(result[0], L"a");
    EXPECT_EQ(result[1], L"b");
    EXPECT_EQ(result[2], L"c");
}
